<?php

try
{
	require_once 'init.inc';
	require_once 'cf/gallery.inc';
	require_once 'cf/image.inc';

	$album = new GalleryAlbum($par->get('albumId'));
	$path[] = array('Фото альбомы','gallery.php');
	$title = $album->name();

	$imagesObj = new GalleryImages($album->id());
	$images = $imagesObj->toArray();

	$imagePreviews = array();
	foreach ($imagesObj as $image) 
	{
		if ($image->image())
		{
			$thumb = new Thumbnail($image->image(), 250, 150);
			$imagePreviews[] = $thumb->toArray();
		}
		else 
		{
			$imagePreviews[] = false;
		}
	}

	assignTemplateVars('title','album','images','imagePreviews');
	display('album');
}
catch (Exception $e)
{
	header('Location: gallery.php');
}
?>